<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
</ul>

<script>
    Array.prototype.slice2 = function (start = 0, end = this.length) {
        console.log(`打印看看当前的 this： ${this}`)	// [object NodeList]
        const result = []
        for (let i = start; i < end; i++) {
            result.push(this[i])
        }
        return result
    };

    // 试一试效果
    const nodeArr = [].slice2.call(document.querySelectorAll('li'))	// [li, li, li]
    const nodeArr2 = [].slice2.call(document.querySelectorAll('li'), 0, 2) // [li, li]
    console.log(nodeArr);
    console.log(nodeArr2);
</script>
</body>
</html>
